<template>
    <div class="child2">
        <h4>子组件2</h4>
        <p>子组件2中的数据是 {{ num }}</p>
    </div>
</template>

<script setup>
    import {ref} from 'vue';

    const num  = ref(20);

    defineExpose({num});
</script>

<style>
    .child2 {
        width: 300px;
        height: 100px;
        background-color: cadetblue;
    }
</style>